<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      class Person {
        constructor() {
          this.username = "jack";
        }
        // 语法糖，写法简洁功能一样
        say() {
          console.log("hello jack");
        }
      }
      // Person.prototype.say = function () {
      //   console.log("hello jack");
      // };
      const p1 = new Person();
      const p2 = new Person();
      //返回值为true 说明方法是共享的 ，方法共享属性独立
      console.log(p1.say === p2.say);
    </script>
  </body>
</html>
